#include<stdlib.h>
#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<unistd.h>
#include <fcntl.h>
#include<sys/mman.h>

typedef struct
{
    int integer;
    char string[24];
} RECORD;

int main(int argc,char **argv){
    int f;
    RECORD *recore;
    struct stat st;

   
    f = open("records.dat", O_RDWR);
    stat("records.dat", &st);
    
    recore = (RECORD *)mmap(NULL,st.st_size,PROT_READ | PROT_WRITE, MAP_SHARED, f,0);
    printf("integer = %d \n string = %s \n", recore[2].integer, recore[3].string);

    munmap((void *)recore,st.st_size);

    close(f);



   return 0;
}